<template>
	<view class="page">
		<view class="page-head flex f-a-center f-j-center">
			<view class="page-head-item">
				<view class="page-head-item-money">{{blance||0}}</view>
				<view class="page-head-item-text">充入</view>
			</view>
			<view class="page-head-item">
				<view class="page-head-item-money">{{yesterday_earnings||0}}</view>
				<view class="page-head-item-text">退取</view>
			</view>
		</view>
		<view class="page-list">
			<view class="page-list-head flex f-a-center">
				<view>日期</view>
				<view>状态</view>
				<view>金额</view>
			</view>
			<view class="page-list-page" v-for="(item,index) in datalist" :key="index">
				<view class="page-list-page-item flex f-a-center">
					<view>{{item.create_time}}</view>
					<!-- <view>{{item.member_id}}</view> -->
					<view>{{item.status_text}}</view>
					<view class="page-list-page-item-red">{{item.money}}</view>
				</view>
			</view>
		</view>
		<mix-load-more :status="loadMoreStatus"></mix-load-more>
	</view>
</template>

<script>
	import henglang from '@/common/common.js';
	export default {
		data() {
			return {
				blance:0,
				yesterday_earnings:0,
				datalist:[],
				loadMoreStatus:1,
				page:1,
				total_pages:1,
				stateType:''
			};
		},
		methods: {
			getData(type){
				let that = this
				that.loadMoreStatus = 1
				if(that.total_pages == 0) that.total_pages = 1
				if(that.page <= that.total_pages){
					henglang.get('stat/fundDetail',{type:that.stateType,page:that.page},true,function(res){
						if(type == 'loadMore'){
							that.datalist = that.datalist.concat(res.data.data.data)
						}else{
							that.datalist = res.data.data.data
							that.yesterday_earnings = res.data.data.yesterday_earnings
							that.blance = res.data.data.blance
							that.total_pages = res.data.data.total_pages
							that.loadMoreStatus = that.total_pages == 1?2:0
						}
						uni.stopPullDownRefresh()
					})
				}else{
					that.loadMoreStatus = 2
				}
			},
		},
		onLoad({type,name}) {
			this.stateType = type
			uni.setNavigationBarTitle({
				title:name
			})
			this.getData()
		},
		onReachBottom() {
			this.page++
			this.getData('loadMore')
		},
		onPullDownRefresh() {
			this.page = 1
			this.getData()
		}
	}
</script>

<style lang="scss" scoped>
	.flex{
		display: flex;
	}
	.f-a-center{
		align-items: center;
	}
	.f-j-center{
		justify-content: center;
	}
	.page{
		&-head{
			background-image: url('~@/static/images/ydt/deital_head.png');
			background-size: 100% 100%;
			background-repeat: no-repeat;
			height: 150rpx;
			text-align: center;
			&-item{
				flex: 1;
				color: #FFFFFF;
				&-money{
					font-size: 34rpx;
					padding-bottom: 4rpx;
				}
				&-text{
					font-size: 30rpx;
				}
			}
		}
		&-list{
			&-head{
				padding-top: 26rpx;
				view{
					flex: 1;
					text-align: center;
					font-size: 34rpx;
				}
			}
			&-page{
				&-item{
					padding: 13rpx 0;
					view{
						flex: 1;
						text-align: center;
						font-size: 28rpx;
						color: #666666;
					}
					&-red{
						color: #ec1c1c !important;
					}
				}
				&:nth-child(odd){
					background-color: #f2f7f3;
				}
			}
		}
	}
</style>
